package com.yiqihaha.devin.web;

import com.yiqihaha.devin.domain.dto.PersonDTO;
import com.yiqihaha.devin.service.inf.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * Created by devin on 3/8/17.
 */
@RestController
public class DevinController {
    @Autowired
    private IPersonService personService ;

    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String helloGet(){
        return "hello GET";
    }

    @RequestMapping(value = "/hello",method = RequestMethod.POST)
    public String helloPOST(){
        return "hello POST";
    }
    @RequestMapping(value = "/hello",method = RequestMethod.PUT)
    public String helloPUT(){
        return "hello PUT";
    }
    @RequestMapping(value = "/hello",method = RequestMethod.DELETE)
    public String helloDELETE(){
        return "hello DELETE";
    }

    @RequestMapping(value = "/serial/{serial}", method = RequestMethod.GET)
    public PersonDTO personBySerial(@PathVariable String serial){
        PersonDTO person = personService.personBySerial(serial);
        return person;
    }
}
